package org.examples.javax.script;

import static org.junit.Assert.assertEquals;

import java.util.List;

import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager;

import org.junit.Test;

public class ScriptEngineManagerTest
{
    ScriptEngineManager scriptEngineManager = new ScriptEngineManager();

    @Test
    public void testGettters()
    {
        List<ScriptEngineFactory> engineFactories = scriptEngineManager.getEngineFactories();
        assertEquals(1, engineFactories.size());
        ScriptEngineFactory rhinoEngineFactory = engineFactories.get(0);
        System.out.println(rhinoEngineFactory.getEngineName());
        System.out.println(rhinoEngineFactory.getEngineVersion());
        System.out.println(rhinoEngineFactory.getLanguageName());
        System.out.println(rhinoEngineFactory.getLanguageVersion());
        System.out.println(rhinoEngineFactory.getNames());
        System.out.println(rhinoEngineFactory.getExtensions());
        System.out.println(rhinoEngineFactory.getMimeTypes());
        assertEquals("print(\"AAA\")", rhinoEngineFactory.getOutputStatement("AAA"));
        assertEquals("MULTITHREADED", rhinoEngineFactory.getParameter("THREADING"));
        assertEquals("Object.method(arg1,arg2)",
            rhinoEngineFactory.getMethodCallSyntax("Object", "method", "arg1", "arg2"));
        assertEquals("A;B;", rhinoEngineFactory.getProgram("A", "B"));
    }
}
